package com.llk.p;

import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
import org.docx4j.openpackaging.parts.Parts;
import org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart;

import java.io.File;
import java.io.FileInputStream;

/**
 * 获取 document.xml 主内容
 */
public class Test02 {

    public static void main(String[] args) throws Exception{
        String filePath = "p/1.docx";
        String destPath = "p/dest/1.docx";
        WordprocessingMLPackage wPackage = WordprocessingMLPackage.load(new FileInputStream(filePath));

        MainDocumentPart document = wPackage.getMainDocumentPart();
        Object o = document.getContent().get(0);


        wPackage.save(new File(destPath));
    }
}
